from Structure import Queue

# 队列实现传土豆
def hotPotato(namelist, num):
    simqueue = Queue()
    for name in namelist:
        simqueue.enqueue(name)

    while simqueue.size() > 1:
        for i in range(num):
            simqueue.enqueue(simqueue.dequeue())

        simqueue.dequeue() # 出局
    
    return simqueue.dequeue()

namelist = ["Bill", "David", "Susan", "Jane", "Kent", "Brad"]
result = hotPotato(namelist, 3)
print(result)